package net.jjjshop.common.service.lbt.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.jjjshop.common.entity.lbt.LbSysConfigEntity;
import net.jjjshop.common.mapper.lbt.LbSysConfigMapper;
import net.jjjshop.common.service.lbt.LbSysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 系统配置表 接口实现类
 */

@Service("lbSysConfigService")
public class LbSysConfigServiceImpl extends ServiceImpl<LbSysConfigMapper, LbSysConfigEntity> implements LbSysConfigService {
@Autowired
private LbSysConfigMapper dao;
    @Override
    public LbSysConfigEntity selectSysConfig() {
        LambdaQueryWrapper<LbSysConfigEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.orderByDesc(LbSysConfigEntity::getId);
        List<LbSysConfigEntity> lbSysConfigEntities = dao.selectList(wrapper);
        if (null == lbSysConfigEntities || lbSysConfigEntities.isEmpty()){
            return null;
        }
        return lbSysConfigEntities.get(0);
    }
}
